//获取店铺
var getShop = function () {
    var shopQuery = {};
    var filters = {
        "rules": [
            {
                "field": "type",
                "data": 'kt'
            },
            {
                "field" : "state",
                "data": '1'
            }
        ]
    };

    shopQuery.shopType = "'直营','加盟'";
    shopQuery.filters = JSON.stringify(filters);
    shopQuery.state = '5';
    $.ajax({
        url: '${contextPath}/ktCommon/getShopList2User',
        type: 'post',
        data: shopQuery,
        success: function (data) {
            console.log(data);
            var shopArray = []
            for(var i = 0; i < data.length; i++){
                var shop = {}
                shop.value = data[i].shopName;
                shop.data = data[i].shopId;
                shopArray.push(shop);
            }

            var countries = shopArray

            console.log(countries);
            $('#shopNameId').autocomplete({
                lookup: countries,
                onSelect: function (suggestion) {
                    // alert('You selected: ' + suggestion.value + ', ' + suggestion.data);
                },
                minChars: 0,
            });
        },
//            success: function (data) {
//                if(data.length == 0){
//                    return;
//                }
//                var dataArray = data;
//                app.arrayShop = dataArray;
//
////                queryModel.shopId = data[0].shopId;
////                queryModel.shopId = '2889';
//
//            },
        error: function (error){
            // get();
            layer.msg("获取出错："+data.message)
        }
    })
}

